<!DOCTYPE html>
<html>
<head xmlns="http://www.w3.org/1999/xhtml">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Number tools - Powered by Nguyen Kim Kha</title>
	<script src="converter.js"></script>
	<script>
function getURLParameter(name) {
    return decodeURI(
        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
    );
}

function $g(id) {
	return document.getElementById(id);
}

function $n(text) {
	var result = parseInt(text);
	if (isNaN(result)) {
		return false;
	}
	return result;
}

window.onload = function(){
	var text = getURLParameter('text');
	$g('num').innerText = text;
	
	var num = $n(text);
	if (num == false) {
		$g('result').innerText = "That is not number!";
	} else {
		$g("hex").innerText = toHex(num);
		$g("oct").innerText = toOct(num);
		$g("date").innerText = toDate(num);
	}
}

	</script>
</head>
<body>
<h3>Result for: <span id="num"></span></h3>
<div id="result">

	<table border="1" cellpadding="4">
	<thead>
		<tr>
			<th>Kind</th>
			<th>Value</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<th colspan="2">Number conversions</th>
		</tr>
		<tr>
			<td>Hexadecimals:</td>
			<td><span id="hex"></span></td>
		</tr>
		<tr>
			<td>Octals:</td>
			<td><span id="oct"></span></td>
		</tr>
		
		<tr>
			<th colspan="2">Date Time conversions</th>
		</tr>
		<tr>
			<td>Date string:</td>
			<td><span id="date"></span></td>
		</tr>
	</tbody>
	</table>

</div>
</body>
</html>

















